Optimal. Leaf size=80 \[ -\frac {2 \sqrt {a^2-b^2} \tan ^{-1}\left (\frac {a \tan \left (\frac {1}{2} (c+d x)\right )+b}{\sqrt {a^2-b^2}}\right )}{a^2 d}+\frac {b \tanh ^{-1}(\cos (c+d x))}{a^2 d}-\frac {\cot (c+d x)}{a d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.25, antiderivative size = 80, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 7, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {2723, 3056, 3001, 3770, 2660, 618, 204} \[ -\frac {2 \sqrt {a^2-b^2} \tan ^{-1}\left (\frac {a \tan \left (\frac {1}{2} (c+d x)\right )+b}{\sqrt {a^2-b^2}}\right )}{a^2 d}+\frac {b \tanh ^{-1}(\cos (c+d x))}{a^2 d}-\frac {\cot (c+d x)}{a d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 204
Rule 618
Rule 2660
Rule 2723
Rule 3001
Rule 3056
Rule 3770
Rubi steps
\begin {align*} \int \frac {\cot ^2(c+d x)}{a+b \sin (c+d x)} \, dx &=\int \frac {\csc ^2(c+d x) \left (1-\sin ^2(c+d x)\right )}{a+b \sin (c+d x)} \, dx\\ &=-\frac {\cot (c+d x)}{a d}+\frac {\int \frac {\csc (c+d x) (-b-a \sin (c+d x))}{a+b \sin (c+d x)} \, dx}{a}\\ &=-\frac {\cot (c+d x)}{a d}-\frac {b \int \csc (c+d x) \, dx}{a^2}+\frac {\left (-a^2+b^2\right ) \int \frac {1}{a+b \sin (c+d x)} \, dx}{a^2}\\ &=\frac {b \tanh ^{-1}(\cos (c+d x))}{a^2 d}-\frac {\cot (c+d x)}{a d}-\frac {\left (2 \left (a^2-b^2\right )\right ) \operatorname {Subst}\left (\int \frac {1}{a+2 b x+a x^2} \, dx,x,\tan \left (\frac {1}{2} (c+d x)\right )\right )}{a^2 d}\\ &=\frac {b \tanh ^{-1}(\cos (c+d x))}{a^2 d}-\frac {\cot (c+d x)}{a d}+\frac {\left (4 \left (a^2-b^2\right )\right ) \operatorname {Subst}\left (\int \frac {1}{-4 \left (a^2-b^2\right )-x^2} \, dx,x,2 b+2 a \tan \left (\frac {1}{2} (c+d x)\right )\right )}{a^2 d}\\ &=-\frac {2 \sqrt {a^2-b^2} \tan ^{-1}\left (\frac {b+a \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2-b^2}}\right )}{a^2 d}+\frac {b \tanh ^{-1}(\cos (c+d x))}{a^2 d}-\frac {\cot (c+d x)}{a d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 0.24, size = 108, normalized size = 1.35 \[ \frac {-4 \sqrt {a^2-b^2} \tan ^{-1}\left (\frac {a \tan \left (\frac {1}{2} (c+d x)\right )+b}{\sqrt {a^2-b^2}}\right )+a \tan \left (\frac {1}{2} (c+d x)\right )-a \cot \left (\frac {1}{2} (c+d x)\right )-2 b \log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )+2 b \log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )}{2 a^2 d} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.86, size = 314, normalized size = 3.92 \[ \left [\frac {b \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) \sin \left (d x + c\right ) - b \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) \sin \left (d x + c\right ) + \sqrt {-a^{2} + b^{2}} \log \left (\frac {{\left (2 \, a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} - 2 \, a b \sin \left (d x + c\right ) - a^{2} - b^{2} + 2 \, {\left (a \cos \left (d x + c\right ) \sin \left (d x + c\right ) + b \cos \left (d x + c\right )\right )} \sqrt {-a^{2} + b^{2}}}{b^{2} \cos \left (d x + c\right )^{2} - 2 \, a b \sin \left (d x + c\right ) - a^{2} - b^{2}}\right ) \sin \left (d x + c\right ) - 2 \, a \cos \left (d x + c\right )}{2 \, a^{2} d \sin \left (d x + c\right )}, \frac {b \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) \sin \left (d x + c\right ) - b \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) \sin \left (d x + c\right ) + 2 \, \sqrt {a^{2} - b^{2}} \arctan \left (-\frac {a \sin \left (d x + c\right ) + b}{\sqrt {a^{2} - b^{2}} \cos \left (d x + c\right )}\right ) \sin \left (d x + c\right ) - 2 \, a \cos \left (d x + c\right )}{2 \, a^{2} d \sin \left (d x + c\right )}\right ] \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.20, size = 129, normalized size = 1.61 \[ -\frac {\frac {2 \, b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \right |}\right )}{a^{2}} - \frac {\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{a} + \frac {4 \, {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\relax (a) + \arctan \left (\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + b}{\sqrt {a^{2} - b^{2}}}\right )\right )} \sqrt {a^{2} - b^{2}}}{a^{2}} - \frac {2 \, b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - a}{a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}}{2 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [B] time = 0.44, size = 155, normalized size = 1.94 \[ \frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2 a d}-\frac {1}{2 a d \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}-\frac {b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d \,a^{2}}-\frac {2 \arctan \left (\frac {2 a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+2 b}{2 \sqrt {a^{2}-b^{2}}}\right )}{d \sqrt {a^{2}-b^{2}}}+\frac {2 b^{2} \arctan \left (\frac {2 a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+2 b}{2 \sqrt {a^{2}-b^{2}}}\right )}{d \,a^{2} \sqrt {a^{2}-b^{2}}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [F(-2)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: ValueError} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 11.94, size = 204, normalized size = 2.55 \[ -\frac {\mathrm {cot}\left (c+d\,x\right )}{a\,d}-\frac {b\,\ln \left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{a^2\,d}+\frac {\mathrm {atan}\left (\frac {a^3\,\sqrt {b^2-a^2}\,1{}\mathrm {i}-a\,b^2\,\sqrt {b^2-a^2}\,2{}\mathrm {i}-b^3\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {b^2-a^2}\,4{}\mathrm {i}+a^2\,b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {b^2-a^2}\,3{}\mathrm {i}}{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^4-2\,a^3\,b-5\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^2\,b^2+2\,a\,b^3+4\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,b^4}\right )\,\sqrt {b^2-a^2}\,2{}\mathrm {i}}{a^2\,d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F] time = 0.00, size = 0, normalized size = 0.00 \[ \int \frac {\cos ^{2}{\left (c + d x \right )} \csc ^{2}{\left (c + d x \right )}}{a + b \sin {\left (c + d x \right )}}\, dx \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________